package com.his.common;

import com.his.common.Theme.DarkGoldMetalTheme;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.Toolkit;
import javax.swing.UIManager;
import javax.swing.plaf.metal.MetalLookAndFeel;

public class WindowStyle {
	public static final int SYSTEM_STYLE = 48;

	public static final int JAVA_STYLE = 49;

	public static final int METAL_STYLE = 50;

	public static void setWindowStyle(char style) {
		try {
			switch (style) {
			case '0':
				UIManager
						.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel");
				break;
			case '1':
				UIManager
						.setLookAndFeel("javax.swing.plaf.metal.MetalLookAndFeel");
				break;
			case '2':
				UIManager.put("swing.boldMetal", Boolean.FALSE);

				Toolkit.getDefaultToolkit().setDynamicLayout(true);
				System.setProperty("sun.awt.noerasebackground", "true");
				UIManager.setLookAndFeel(new MetalLookAndFeel());

				MetalLookAndFeel.setCurrentTheme(new DarkGoldMetalTheme());
				UIManager
						.setLookAndFeel("javax.swing.plaf.metal.MetalLookAndFeel");
			}
		} catch (Exception ex) {
			ex.printStackTrace();
		}
	}

	public static void setWindowCenter(Component cp) {
		Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
		cp.setLocation(screenSize.width / 2 - cp.getWidth() / 2,
				screenSize.height / 2 - cp.getHeight() / 2);
	}
}